package com.ruoyi.business.service.impl;

import java.util.List;

import com.ruoyi.business.domain.vo.FrontStudentBindingListVO;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.StudentBindingMapper;
import com.ruoyi.business.domain.StudentBinding;
import com.ruoyi.business.service.IStudentBindingService;

/**
 * 学生绑定Service业务层处理
 * 
 * @author lcz
 * @date 2025-02-27
 */
@Service
public class StudentBindingServiceImpl implements IStudentBindingService 
{
    @Autowired
    private StudentBindingMapper studentBindingMapper;

    /**
     * 查询学生绑定
     * 
     * @param id 学生绑定主键
     * @return 学生绑定
     */
    @Override
    public StudentBinding selectStudentBindingById(Long id)
    {
        return studentBindingMapper.selectStudentBindingById(id);
    }

    /**
     * 查询学生绑定列表
     * 
     * @param studentBinding 学生绑定
     * @return 学生绑定
     */
    @Override
    public List<StudentBinding> selectStudentBindingList(StudentBinding studentBinding)
    {
        return studentBindingMapper.selectStudentBindingList(studentBinding);
    }

    /**
     * 新增学生绑定
     * 
     * @param studentBinding 学生绑定
     * @return 结果
     */
    @Override
    public int insertStudentBinding(StudentBinding studentBinding)
    {
        studentBinding.setCreateTime(DateUtils.getNowDate());
        return studentBindingMapper.insertStudentBinding(studentBinding);
    }

    /**
     * 修改学生绑定
     * 
     * @param studentBinding 学生绑定
     * @return 结果
     */
    @Override
    public int updateStudentBinding(StudentBinding studentBinding)
    {
        studentBinding.setUpdateTime(DateUtils.getNowDate());
        return studentBindingMapper.updateStudentBinding(studentBinding);
    }

    /**
     * 批量删除学生绑定
     * 
     * @param ids 需要删除的学生绑定主键
     * @return 结果
     */
    @Override
    public int deleteStudentBindingByIds(Long[] ids)
    {
        return studentBindingMapper.deleteStudentBindingByIds(ids);
    }

    /**
     * 删除学生绑定信息
     * 
     * @param id 学生绑定主键
     * @return 结果
     */
    @Override
    public int deleteStudentBindingById(Long id)
    {
        return studentBindingMapper.deleteStudentBindingById(id);
    }

    @Override
    public List<FrontStudentBindingListVO> frontStudentBindingList(Long testSessionId) {
        return studentBindingMapper.frontStudentBindingList(testSessionId);
    }

    @Override
    public int batchAdd(List<StudentBinding> studentBindingList) {
        return studentBindingMapper.batchAdd(studentBindingList);
    }

    @Override
    public void batchDelete(Long schoolId, Long testSessionId) {
        studentBindingMapper.batchDelete(schoolId, testSessionId);
    }
}
